using Dapper;
using System.Data;

namespace AdminApiTemplate.Services.SysConfig
{
    public class SysConfigService
    {
        private readonly IDbConnection _dbConnection;

        public SysConfigService(
            IDbConnection dbConnection)
        {
            _dbConnection = dbConnection;
        }

        /// <summary>
        /// 初始化配置
        /// </summary>
        /// <returns></returns>
        public async Task<IEnumerable<SysConfigDto>> InitSysConfigAsync()
        {
            var sql = "select KeyName,Val from SysConfig";
            var items = await _dbConnection.QueryAsync<SysConfigDto>(sql);
            return items;
        }
    }
}
